package com.hbsc.controller;

import com.hbsc.domain.RegisterVo;
import com.hbsc.service.RegisterService;
import com.hbsc.utils.WechartUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by 范柳 on 2017-10-16.
 */
@Controller
@RequestMapping("/register")
public class RegisterController extends BaseController {
    private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RegisterController.class);
    @Autowired
    private RegisterService registerService;

    @Value("${wx.accesstokenurl}")
    public String accesstokenurl;
    @Value("${wx.appid}")
    public String appid;
    @Value("${wx.secret}")
    public String secret;
    @Autowired
    private WechartUtil util;

    @RequestMapping("/list")
    public String registerList(HttpServletRequest request, Model model){
        Map userInfo=userInfo(request);
        logger.info("用户基本信息：{}",userInfo);
        List<RegisterVo> registerList = registerService.queryRegisterList();
        model.addAttribute("userInfo",userInfo);
        model.addAttribute("registerList",registerList);
        return "test/registerList";
    }
}
